<include file="public:header" />
<div class="allpagetop">网站配置<strong>/</strong>微信菜单<strong>/</strong>添加</div>
<div class="admin_main_nr_dbox">
  <div class="pagetit">
    <div class="ptit">微信菜单</div>
    <div class="topnav">
      <a href="{:RU('Weixin/menu_list')}" <if condition="ACTION_NAME eq 'menu_list'">class="select"</if>>列表</a>
      <a href="{:RU('Weixin/menu_add')}" <if condition="ACTION_NAME eq 'menu_add'">class="select"</if>>添加</a>
      <div class="clear"></div>
    </div>
    <div class="clear"></div>
  </div>
  
  
  <div class="toptit">添加微信菜单</div>
  <form action="{:RU('Weixin/menu_edit')}" method="post" name="FormData" id="FormData" >
    <input type="hidden" name="id" value="{$menu.id}">
    <div class="admin_form_main">
      <div class="fl">菜单名称:</div>
      <div class="fr"><input name="name" type="text" class="input_text_default" maxlength="60" placeholder="请输入菜单名称" value="{$menu.name}" /></div>
      <div class="fl">菜单排序:</div>
      <div class="fr">
        <input name="sort" value="{$menu.sort}" type="text"  class="input_text_default"  maxlength="8" onkeyup="if(event.keyCode !=37 && event.keyCode != 39) value=value.replace(/\D/g,'');"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\D/g,''))"   placeholder="数字越大越靠前，默认是0"/>
      </div>
      <div class="fl">所属父菜单:</div>
      <div class="fr"><input name="pid_cn" id="pid_cn" type="text"  class="input_text_default J_cat_show" maxlength="60" placeholder="请选择所属分类" readonly="readonly" value="{$pid_cn}"/></div>
      <input name="pid" type="hidden"  id="pid" value="{$pid|default='0'}" />
      <div class="fl">菜单类型:</div>
      <div class="fr">
        <div class="imgradio" id="J_menu_type">
          <input name="type" type="hidden" value="{$menu.type}"/>
          <div class="radio {$menu['type']=='click' ? 'select' : ''}" data="click">关键词</div>
          <div class="radio {$menu['type']=='view' ? 'select' : ''}" data="view">链接</div>
          <div class="clear"></div>
        </div>
      </div>
      <eq name="menu.type" value="click">
        <div id="J_type_click">
          <div class="fl">关键词:</div>
          <div class="fr"><input name="key" value="{$menu.key}" type="text" class="input_text_default" maxlength="60" placeholder=""/></div>
        </div>
        <div id="J_type_view"  style="display: none;">
          <div class="fl">URL:</div>
          <div class="fr"><input name="url" value="{$menu.url}" type="text" class="input_text_default" maxlength="60" placeholder=""/></div>
        </div>
        <else/>
        <div id="J_type_click"  style="display: none;">
          <div class="fl">关键词:</div>
          <div class="fr"><input name="key" value="{$menu.key}" type="text" class="input_text_default" maxlength="60" placeholder=""/></div>
        </div>
        <div id="J_type_view">
          <div class="fl">URL:</div>
          <div class="fr"><input name="url" value="{$menu.url}" type="text" class="input_text_default" maxlength="60" placeholder=""/></div>
        </div>
      </eq>
      
      <div class="fl">是否启用:</div>
      <div class="fr">
        <div class="imgchecked {$menu['status']=='1' ? 'select' : ''}">
        <input name="status" type="hidden" value="{$menu.status}" />
      </div>
    </div>
      <div class="fl"></div>
      <div class="fr">
        <input name="" type="submit" class="admin_submit big"    value="保存分类"/>
      </div>
      <div class="clear"></div>
    </div>
    <div id="J_cat_from"></div>
  </form>
</div>

<div id="J_cat_select" style="display:none">
  
  <div class="showdialog">
    <div class="dtit">请选择菜单</div>
    <div class="dlistx" id="0" >顶级菜单</div>
    <volist name="menulist" id="menu">
      <div class="dlistx" id="{$menu.id}">{$menu.name}</div>
    </volist>
    <div class="clear"></div>
  </div>

</div>


<include file="public:footer" />
<script type="text/javascript">
    $(document).ready(function()
    {
        $(".J_cat_show").dialog({
            DialogAddObj:"#J_cat_from",
            DialogTitle:"请选择所属菜单",
            DialogContent:"#J_cat_select",
            DialogContentType:"id"
        });

        $('#J_cat_from .dlistx').live('click',function() {
            $("#pid_cn").val($(this).html());
            $("#pid").val($(this).attr('id'));
            $(" .FloatBg").remove();
            $(" .FloatBox").remove();
        });

        // 菜单类型输入框控制
        $('#J_menu_type').on('click', 'div.radio', function () {
            var type = $(this).attr('data');
            $("#J_type_click,#J_type_view").hide();
            $("#J_type_"+type).show();
        });
    });
</script>
</body>
</html>